package com.ztesoft.iom.adapter.server.result;

/**
 * @author zhao.mengkang@ztesoft.com
 * @date 2018年04月09日
 *
 * 开通适配器结果集
 */

public class IomResult<T> {
    private Integer retCode;
    private String retMsg;
    private T retData;

    public IomResult() {
        this.retCode = IomResultCodes.success().getCode();
        this.retMsg = IomResultCodes.success().getMessage();
    }

    public IomResult(IomResultCodes iomResultCodes) {
        this.retCode = iomResultCodes.getCode();
        this.retMsg = iomResultCodes.getMessage();
    }

    public IomResult(T retData) {
        this.retCode = IomResultCodes.success().getCode();
        this.retMsg = IomResultCodes.success().getMessage();
        this.retData = retData;
    }

    public IomResult(IomResultCodes iomResultCodes , T retData) {
        this.retCode = iomResultCodes.getCode();
        this.retMsg = iomResultCodes.getMessage();
        this.retData = retData;
    }

    public void setRetCode(Integer retCode) {
        this.retCode = retCode;
    }

    public void setRetMsg(String retMsg) {
        this.retMsg = retMsg;
    }

    public void setRetData(T retData) {
        this.retData = retData;
    }

    public Integer getRetCode() {
        return retCode;
    }

    public String getRetMsg() {
        return retMsg;
    }

    public T getRetData() {
        return retData;
    }

    @Override
    public String toString() {
        return "IomResult{" +
                "retCode=" + retCode +
                ", retMsg='" + retMsg + '\'' +
                ", retData=" + retData +
                '}';
    }
}
